package com.lmx.repoDomain.tmodel;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToMany;

/**
 * 字段枚举
 *
 * @author ytche
 * @date 2017年8月2日
 *
 */
@Entity
@Table(name = "TNB_RISK_FIELD_ENUM")
@JsonApiResource(type = "riskFieldEnum")
public class RiskFieldEnum extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private String name;
	private String value;
	private String remark;
	private Integer sort;
	private Integer min;
	private Integer max;
	private Set<RiskRecordField> fields;

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "value")
	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "sort")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@Column(name = "min")
	public Integer getMin() {
		return min;
	}

	public void setMin(Integer min) {
		this.min = min;
	}

	@Column(name = "max")
	public Integer getMax() {
		return max;
	}

	public void setMax(Integer max) {
		this.max = max;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH, mappedBy = "enums")
	@Fetch(FetchMode.SELECT)
	@JsonApiToMany
	@JsonApiLookupIncludeAutomatically
	public Set<RiskRecordField> getFields() {
		return fields;
	}

	public void setFields(Set<RiskRecordField> fields) {
		this.fields = fields;
	}

}
